

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
<script type="text/javascript" src="helpman_topicinit.js"></script>

<title>Debug Java Web Servers [Enterprise Architect User Guide]</title>

<meta name="keywords" content="Enterprise Architect, Sparx Systems, UML, Java,Java Web Servers, Debugging,Debug,Debug Java Web Servers,JBOSS,JBOSS Server, Debugging,Tomcat,Tomcat Server, Debugging,Server,Server JBOSS, Debugging,Server Apache Tomcat, Debugging,Server Tomcat, Debugging,Web Server,Web Server Java,Apache Tomcat,Apache Tomcat Server, Debugging">
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<meta http-equiv="Content-Style-Type" content="text/css" />

<link type="text/css" href="default.css" rel="stylesheet" />
<style type="text/css">
  A, A:Visited
  {
    color: #00F;
  }

  A:Active, A:Hover
  {
    color: #F00;
  }

  OL
  {
    margin: 5px 0 5px 48px;
  }

  UL
  {
    margin-bottom: 3px;
    margin-top: 0;
  }

  #nsr
  {
    background-color: #D4DFFF;
  }

  #nsr A
  {
    text-decoration: none;
  }

  #mainbody
  {
    padding: 8px;
  }

  .p_BodyText
  {
    padding: 5px 0;
  }
</style>



<style type="text/css" media="screen">
  BODY
  {
    background-color: #FFFFFF;
  }

  #nsr
  {
    padding: 6px 6px 0 6px;
    border-bottom: none;
    vertical-align: top;
    z-index: 2;
    visibility: visible;
    left: 0;
    top: 0;
    position: absolute;
  }

  #mainbody
  {
    left: 0;
    top: 0;
    margin: 0;
    position: absolute;
    padding: 10px;
    overflow: auto;
    height: 100%;
    z-index: 1;
    background-repeat: no-repeat;
    background-position: bottom right;
    background-attachment: fixed;
  }
</style>

<style type="text/css" media="print">
  #nsr
  {
    visibility: none;
  }

  #mainbody
  {
    overflow: visible;
  }
</style>
<script type="text/javascript" language="JavaScript" src="nonscroll.js"></script>

</head>
<body scroll="no">

<div id="page">



        <div id="content">
          <div id="content-inner">
          



  
          <div id="nsr">
            <table border="0" cellspacing="0" cellpadding="4" width="100%">
              <tr valign="top">
                <td align="left">
  


                  <p class="p_Heading1"><span class="f_Heading1">Debug Java Web Servers</span></p>



  
                </td>
                <td align="right">
                  <a href="introduction.htm" onmouseover="document.images.main.src='button_main_h.gif'" onmouseout="document.images.main.src='button_main.gif'">
                    <img name="main" src="button_main.gif" border=0 alt="Return to Introduction">
                  </a>&nbsp;
    
                  <a href="debugging_another_process.htm" onmouseover="document.images.prev.src='button_prev_h.gif'" onmouseout="document.images.prev.src='button_prev.gif'">
                    <img name=prev src="button_prev.gif" border=0 alt="Previous page" />
                  </a>&nbsp;
    
    
    
                  <a href="jboss_server_configuration.htm" onmouseover="document.images.next.src='button_next_h.gif'" onmouseout="document.images.next.src='button_next.gif'">
                    <img name=next src="button_next.gif" border=0 alt="Next page" />
                  </a>
    
    
                </td>
              </tr>
            </table>
          </div>
          <div id="mainbody">
  


                <p class="p_BodyText"><span class="f_BodyText">This topic describes the configuration requirements and procedure for debugging Java web servers such as <a href="jboss_server_configuration.htm">JBOSS</a> and Apache Tomcat (both <a href="tomcat_server_configuration.htm">Server</a> configuration and <a href="tomcat_service_configuration_w.htm">Windows Service</a> configuration) in Enterprise Architect.</span></p>
<p class="p_BodyText"><span class="f_BodyText">The procedure involves attaching to the process hosting the Java Virtual Machine from Enterprise Architect, as summarized below:</span></p>
<ol style="text-indent: 0px; margin-left: 48px; list-style-position: outside;">
<li value=1><span class="f_NumberedList">Ensure binaries for the web server code to be debugged have been built with debug information.</span></li>
<li value=2><span class="f_NumberedList">Launch the server with the Virtual Machine <a href="debugging_java_web_servers.htm#VM">startup option</a> described in this topic.</span></li>
<li value=3><span class="f_NumberedList">Import source code into the Enterprise Architect Model, or synchronize existing code.</span></li>
<li value=4><span class="f_NumberedList">Create or modify the <a href="debugging_java_web_servers.htm#PBS">Package Build Script</a> to specify the </span><span class="f_MenuKeyField">Debug</span><span class="f_NumberedList"> option for attaching to the process.</span></li>
<li value=5><span class="f_NumberedList">Set <a href="breakpoints.htm">breakpoints</a>.</span></li>
<li value=6><span class="f_NumberedList">Launch the client.</span></li>
<li value=7><span class="f_NumberedList">Attach to the process from Enterprise Architect.</span></li>
</ol>
<p class="p_SubHeadingL1"><a name="vm"></a><span class="f_SubHeadingL1">Server Configuration</span></p>
<p class="p_BodyText"><span class="f_BodyText">The configuration necessary for the web servers to interact with Enterprise Architect must address the following two essential points:</span></p>
<ul style="text-indent: 0px; margin-left: 30px; list-style-position: outside;">
<li><span class="f_Bulletlist1">Any VM to be debugged, created or hosted by the server must have the Sparx Systems Agent </span><span class="f_Code">SSJavaProfiler65</span><span class="f_Bulletlist1"> command line option specified in the VM startup option (that is: </span><span class="f_Code">-agentlib:SSJavaProfiler71</span><span class="f_Bulletlist1">)</span></li>
<li><span class="f_Bulletlist1">The CLASSPATH, however it is passed to the VM, must specify the root path to the package source files.</span></li>
</ul>
<p class="p_BodyText"><span class="f_BodyText">The Enterprise Architect debugger uses the </span><span class="f_Code">java.class.path</span><span class="f_BodyText"> property in the VM being debugged, to locate the source file corresponding to a breakpoint occurring in a Class during execution. For example, a Class to be debugged is called:</span></p>
<p class="p_Code"><span class="f_Code">a.b.C</span></p>
<p class="p_BodyText"><span class="f_BodyText">This is located in physical directory:</span></p>
<p class="p_Code"><span class="f_Code">C:\source\a\b</span></p>
<p class="p_BodyText"><span class="f_BodyText">So, for debugging to be successful, the CLASSPATH must contain the root path:</span></p>
<p class="p_Code"><span class="f_Code">c:\source</span><span class="f_TextIndentedL2" style="font-style: italic;">.</span></p>
<p class="p_SubHeadingL1"><a name="pbs"></a><span class="f_SubHeadingL1">Package Script Configuration</span></p>
<p class="p_BodyText"><span class="f_BodyText">Using the <a href="java_setup.htm">Debug tab</a> of the <a href="buildandrun.htm">Build Script</a> dialog, create a script for the code you have imported and specify the following:</span></p>
<ul style="text-indent: 0px; margin-left: 30px; list-style-position: outside;">
<li><span class="f_Bulletlist1">Select the </span><span class="f_MenuKeyField">Attach to process </span><span class="f_Bulletlist1">radio button, and in the field below type </span><span class="f_MenuKeyField">attach</span><span class="f_Bulletlist1">.</span></li>
<li><span class="f_Bulletlist1">In the </span><span class="f_MenuKeyField">Use Debugger</span><span class="f_Bulletlist1"> field, click on the drop-down arrow and select </span><span class="f_MenuKeyField">Java</span><span class="f_Bulletlist1">.</span></li>
</ul>
<p class="p_TextIndentedL2"><img src="attach_script.png" width="687" height="433" border="0" alt="attach_script"></p>
<p class="p_BodyText"><span class="f_BodyText">All other fields are unimportant. The </span><span class="f_MenuKeyField">Directory</span><span class="f_BodyText"> field is normally used in the absence of any Class path property.</span></p>
<p class="p_SubHeadingL1"><span class="f_SubHeadingL1">Debugging</span></p>
<p class="p_BodyText"><span class="f_BodyText">First ensure that the server is running, and that the server process has loaded the Sparx Systems Agent DLL </span><span class="f_Code">SSJavaProfiler71.DLL</span><span class="f_BodyText"> (use </span><span class="f_BodyText" style="font-style: italic;">Process Explorer</span><span class="f_BodyText"> or similar tools to prove this).</span></p>
<p class="p_BodyText"><span class="f_BodyText">Launch the client and ensure the client executes. This must be done before attaching to the server process in Enterprise Architect.</span></p>
<p class="p_BodyText"><span class="f_BodyText">After the client has been executed at least once, return to Enterprise Architect, open the source code you imported and set some <a href="breakpoints.htm">breakpoints</a>.</span></p>
<p class="p_BodyText"><span class="f_BodyText">Click on the </span><span class="f_MenuKeyField"><a href="using_the_debugger.htm">Run Debugger</a></span><span class="f_BodyText"> button in Enterprise Architect. The </span><span class="f_UIControl">Attach To Process</span><span class="f_BodyText"> dialog displays.</span></p>
<p class="p_TextIndentedL2"><img src="attach_to_process.png" width="584" height="408" border="0" alt="attach_to_process"></p>
<p class="p_BodyText"><span class="f_BodyText">Click on the </span><span class="f_MenuKeyField">OK</span><span class="f_BodyText"> button. A confirmation message displays in the </span><span class="f_UIControl"><a href="output.htm">Debug Output window</a></span><span class="f_BodyText">, stating that the process has been attached.</span></p>
<p class="p_BodyText"><span class="f_BodyText">The breakpoints should remain enabled (bright red). If the breakpoints fail, and contain either an exclamation mark or a question mark, then either the process is not hosting the </span><span class="f_Code">SSJavaprofiler71</span><span class="f_BodyText" style="font-style: italic;"> </span><span class="f_BodyText">Agent</span><span class="f_BodyText"> or the binaries being executed by the server are not based on the source code. If so, check your configuration.</span></p>




            </div>
          </div>
        </div>



</div>


</body>
</html>
